$(function(){
	$.post("proCategory.action",function(data){
    	$("#category").append(data);
    });
	$.post("product.action",function(data){
    	$("#item").append(data);
    });
	$.post("purchasePlace.action",function(data){
    	$("#place").append(data);
    });
	
	//执行查询操作，并显示结果
    function PerformSearch()
    {
    	var url="searchInventory.action?"+$("#form1").serialize();
		$("#content").show();
		$("#content").dataTable({
			"bJQueryUI": true,
			"sPaginationType": "full_numbers",
			"bProcessing":true,
			"sAjaxSource":url,			
			"bDestroy":true,
			"sDom":'CT<"clear">R<"H"lfr>t<"F"ip>',
			"oTableTools":{
				"sSwfPath":"../../JavaScript/DataTables/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf"
				},
			"oColVis": {
						"buttonText": "Change columns"
					}
		});
    }
    
	//查询库存信息
	$("#search").click(function(){
		if($("#category").val()=="All"&&$("#date").val()==""&&$("#item").val()=="All"&&$("#place").val()=="All")
			alert("You must select at least one option to perform search!");
		else
			PerformSearch();
	});
});